#pragma once
#define numOfCommands 16
#define mod_non (char)(2*2*2*2*2*2*2)

typedef struct define_info {
	char *name;
	int value;
    struct define_info *next;
} *node_ptr;

struct command
{
	char *name;    	/* the name of the command */
	char *code;		/* the code of the command */
	char op1Mode;	/* the types that the first operand can be */
	char op2Mode;	/* the types that the second operand can be */
};

extern struct command cmd[];
extern node_ptr ext_list;
extern node_ptr ent_list;
extern node_ptr lable_list;
extern node_ptr lable_list_tmp;
extern node_ptr data_str_list;

void clear_list();
node_ptr list_find(node_ptr list_head_ptr, char *str);
node_ptr list_add(node_ptr list_head_ptr, char *name, int value);

/* free the list */
void listFree(node_ptr list_head_ptr);

/* remove node from the list */
node_ptr removeNode(node_ptr list_head, node_ptr needToRemove);

/* check if the operand type is legal
 * mode: the operand types thats are legal
 * check: the operand type that the function check if leagal
 * return true if check is legal and false otherwish */
int checkIfLegalOpType(char mode, int check);

/* find the command index
 * return the index of the command, if not exict return numOfCommands */
int findTheCommand(char *theCommand);

